package cn.mrlong.base.ktnet.token

import android.util.Log
import cn.mrlong.base.ktnet.RetrofitManager
import okhttp3.Interceptor
import okhttp3.Response

/**
 * 作者：BINGO
 * 时间：2021/04/16 14:25
 * 去掉默认参数 添加token
 */
class TokenHeaderInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val token = RetrofitManager.get().token

        Log.e("TokenHeaderInterceptor", "token : $token")
        val request = chain.request().newBuilder()
            .header("User-Agent","ANDROID")
            .header("Phemr_Token",token)
            .build();

        return chain.proceed(request);
    }
}